﻿<%@ page import="java.util.Date" %>
<%@ page import="com.qipay.baas.model.User" %>
<%@ page import="com.qipay.baas.model.Peizhi" %>
<%@ page import="java.text.SimpleDateFormat" %>
<header class="main-header">
    <script src="<%= request.getAttribute("StaticHost") %>/js/jquery.js"></script>
    <script type="text/javascript">
        document.getElementsByTagName("html")[0].style.fontSize=screen.availWidth/200+"px";
    </script>

    <!-- Logo -->
    <a id="logologo" href="${pageContext.request.contextPath}" class="logo" style="background: #778899;">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini"><b>D</b>ONG</span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b></b>科星商户服务平台</span>
    </a>
    <!-- Header Navbar: style can be found in header.less #00b74a-->
    <nav class="navbar navbar-static-top" style="border:0px solid red;background: #778899;">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button" style="background: #998877;">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>
        <%
            Peizhi peizhi = (Peizhi) request.getAttribute("peizhi");
        %>
        <div class="nav navbar-nav" style="color:#fff;text-align: left;color:#fff;padding:0.7rem;font-size: 1.7rem;
            width: 70%;position: absolute;top:0.5rem ;left: 15%;">
            <div onclick="$('#bbb').show();$('#ccc').show();" style="cursor: pointer;float: left;">
                <%--<img id="reminder" style="height: 2rem;" src="<%= request.getAttribute("StaticHost") %>/img/laba.png">--%>
                &nbsp;&nbsp;公告：</div>
            <div onclick="$('#bbb').show();$('#ccc').show();" style="text-align:left;cursor: pointer;float: left;border:0px solid red;width:70%;overflow:hidden;white-space:nowrap;">
                <span id="noticeContent" style="position: relative;width: 500%;">
                    <%=peizhi==null?"":peizhi.getContent()%>
                </span>
            </div>
            <div style="clear: both;"></div>
        </div>

        <div id="bbb" style="padding-bottom: 3rem;display:none;position: fixed;width:30%;min-width:200px;margin:20% 35% 25% 20%;background: #fff;z-index: 11;">
            <div style="text-align: center;line-height: 4rem;border-bottom: 1px solid #f5f5f5;font-size: 2rem;">
                系统公告
                <a onclick="$('#bbb').hide();$('#ccc').hide();" style="cursor:pointer;font-size:1.2rem;padding:0px 20px;float:right;border-radius: 5px;">关闭</a>
            </div>
            <div style="padding:20px;line-height: 2rem;text-indent:25px;color: red;font-size:1.5rem;">
                <%=peizhi==null?"":peizhi.getContent()%>
            </div>
        </div>
        <div id="ccc" style="display:none;position: fixed;background:#000;opacity: 0.5;height:100%;width:100%;z-index: 10;"></div>
        <script>
            var leftWidth = 400;
            var system ={
                win : false,
                mac : false,
                xll : false
            };
            //检测平台
            var p = navigator.platform;
            system.win = p.indexOf("Win") == 0;
            system.mac = p.indexOf("Mac") == 0;
            system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
            if(!(system.win||system.mac||system.xll)){
                document.getElementById("logologo").style.display="none";
                leftWidth = 50;
                document.getElementById("noticeContent").style.top="0.2rem";
            }
            //广播启动
            var scrollWidth;
            var timer;
            $(function(){
                scrollWidth = $('#noticeContent').innerWidth()-leftWidth;
                setTimeout('timer1()',2000);
                blink('#reminder',0);
            });
            function timer1(){
                timer = setInterval('dongqilai1()',60);
            }
            var leftMove = 1;
            function dongqilai1(){
                $('#noticeContent').animate({right:leftMove+"px"},1);
                leftMove = leftMove+1;
                if(leftMove>=scrollWidth){
                    leftMove=1;
                    //$('#noticeContent').animate({left:leftMove+"px"},500);
                }
            }
            //闪动
            function blink(selector,n){
                n=n+1;
                $(selector).fadeOut('slow', function(){
                    $(this).fadeIn('slow', function(){
                        blink(this,n);
                    });
                });
            }
        </script>
        <div class="navbar-custom-menu" style="border:0px solid red;">
            <%
                User user = (User) session.getAttribute("user");
                String icon = "1.jpg",userName = "未登录";
                if (null!=user){
                    icon = user.getSex()==2?"2.jpg":"1.jpg";
                    userName = user.getName();
                }
            %>

            <ul class="nav navbar-nav">
                <li class="dropdown notifications-menu" id="liNotifyMessageParent">
                    <a href="${pageContext.request.contextPath}/sys/msg">
                        <i class="fa fa-bell-o"></i>
                        <span class="label label-warning" id="spnNotifyMessageCount" style="display:none"></span>
                    </a>
                </li>
                <!-- User Account: style can be found in dropdown.less -->
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <img src="<%= request.getAttribute("StaticHost") %>/img/<%= icon%>" class="user-image" alt="User Image">
                        <span class="hidden-xs"><%= userName%></span>
                    </a>
                    <ul class="dropdown-menu" >
                        <!-- User image -->
                        <li class="user-header" style="background: #778899;">
                            <img src="<%= request.getAttribute("StaticHost") %>/img/<%= icon%>" class="img-circle" alt="User Image">
                            <p>
                                <%= userName%>
                                <small><%
                                    Date date=new Date();
                                    SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
                                    String time=format.format(date);
                                %><%=time%></small>
                               <%-- <small><%= new Date()%></small>--%>
                            </p>
                        </li>

                        <!-- Menu Footer-->
                        <li class="user-footer" >
                            <div class="pull-left">
                                <a href="${pageContext.request.contextPath}/sys/changepwd" class="btn btn-default btn-flat">修改密码</a>
                            </div>
                            <div class="pull-right">
                                <a href="${pageContext.request.contextPath}/logout" class="btn btn-default btn-flat">退出</a>
                            </div>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
</header>